package mi.payment.ui.admin;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import mi.payment.R;
import mi.payment.ui.base.ParentActivity;
import sunmi.sunmiui.title.Title;

/**
 * 签购单打印
 * Created by lj on 2017/2/15.
 */
public class SalesSlipPrintActivity extends ParentActivity {

    private View vSalesSlipParams, vBankCardTradePrint, vScanTradePrint;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sign_singles_print);
        initTitle();
        initView();
        setClickListener();
    }

    /**
     * 初始化标题栏
     */
    private void initTitle() {
        Title mTitle;
        mTitle = (Title) findViewById(R.id.sign_singles_print_title);
        mTitle.setButtonVisibility(false, true, true, true);
        mTitle.setHeadBgColor(getResources().getColor(R.color.colorBar));
        mTitle.setTitleText(getResources().getString(R.string.sign_singles_printing));
        mTitle.setMenuClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                SalesSlipPrintActivity.this.finish();
            }
        }, null, null, null);
    }

    /**
     * 初始化控件
     */
    private void initView() {
        TextView leftText, rightText;
        vSalesSlipParams = findViewById(R.id.sales_slip_params);
        vBankCardTradePrint = findViewById(R.id.bank_card_trade_print);
        vScanTradePrint = findViewById(R.id.scan_trade_print);

        leftText = (TextView) vSalesSlipParams.findViewById(R.id.item_left_text);
        leftText.setText(getResources().getString(R.string.sign_singles_params));
        rightText = (TextView) vSalesSlipParams.findViewById(R.id.item_right_text);
        rightText.setVisibility(View.GONE);

        leftText = (TextView) vBankCardTradePrint.findViewById(R.id.item_left_text);
        leftText.setText(getResources().getString(R.string.bank_card_trade_print));
        rightText = (TextView) vBankCardTradePrint.findViewById(R.id.item_right_text);
        rightText.setVisibility(View.GONE);

        leftText = (TextView) vScanTradePrint.findViewById(R.id.item_left_text);
        leftText.setText(getResources().getString(R.string.scan_trade_print));
        rightText = (TextView) vScanTradePrint.findViewById(R.id.item_right_text);
        rightText.setVisibility(View.GONE);
    }

    /**
     * 设置点击监听
     */
    private void setClickListener() {
        vSalesSlipParams.setOnClickListener(this);
        vBankCardTradePrint.setOnClickListener(this);
        vScanTradePrint.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        super.onClick(v);
        Intent intent;
        switch (v.getId()) {
            case R.id.sales_slip_params:
                //跳转到签购单参数页面
                intent = new Intent(this, SalesSlipParamsActivity.class);
                this.startActivity(intent);
                break;
            case R.id.bank_card_trade_print:
                //跳转到银行卡交易打印界面
                intent = new Intent(this, BankTradePrintActivity.class);
                this.startActivity(intent);
                break;
            case R.id.scan_trade_print:
                //跳转到扫码类交易打印界面
                intent = new Intent(this, ScanTradePrintActivity.class);
                this.startActivity(intent);
                break;
        }
    }
}
